import request from '@/config/axios'

// 试题选项 VO
export interface QuestionOptionVO {
  id: number // 主键
  questionId: number // 题目ID
  optionText: string // 选项文本
  optionUrl: string // 选项链接
  corrected: number // 是否正确，0 不正确，1 正确
  version: number // 版本号
}

// 试题选项 API
export const QuestionOptionApi = {
  // 查询试题选项分页
  getQuestionOptionPage: async (params: any) => {
    return await request.get({ url: `/exam/question-option/page`, params })
  },

  // 查询试题选项详情
  getQuestionOption: async (id: number) => {
    return await request.get({ url: `/exam/question-option/get?id=` + id })
  },

  // 新增试题选项
  createQuestionOption: async (data: QuestionOptionVO) => {
    return await request.post({ url: `/exam/question-option/create`, data })
  },

  // 修改试题选项
  updateQuestionOption: async (data: QuestionOptionVO) => {
    return await request.put({ url: `/exam/question-option/update`, data })
  },

  // 删除试题选项
  deleteQuestionOption: async (id: number) => {
    return await request.delete({ url: `/exam/question-option/delete?id=` + id })
  },

  // 导出试题选项 Excel
  exportQuestionOption: async (params) => {
    return await request.download({ url: `/exam/question-option/export-excel`, params })
  },
}